package com.app.utils.util.animotion;

import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.view.animation.TranslateAnimation;

/**
 * 动画公用类
 * @author xuxinghai
 *
 */
public class AppAnimotionuUtils {

	/**
	 * 菜单退出屏幕的动画
	 * @return
	 */
	public static TranslateAnimation getOutScreenBottom(){
		TranslateAnimation hideAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f
				, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f);
		hideAnimation.setFillAfter(true);
		hideAnimation.setDuration(500);
		return hideAnimation;
	}
	
	/**
	 * 菜单进入屏幕的动画
	 * @return
	 */
	public static TranslateAnimation getInScreenBottom(){
		TranslateAnimation showAnimation = new TranslateAnimation(
    			Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
    			Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF,0.0f);
		showAnimation.setFillAfter(true);
		showAnimation.setDuration(500);
		return showAnimation;
	}
	
	/**
	 * 菜单进入屏幕的动画
	 * @return
	 */
	public static TranslateAnimation getOutScreenTop(){
		TranslateAnimation showAnimation = new TranslateAnimation(
    			Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
    			Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,-1.0f);
		showAnimation.setFillAfter(true);
		showAnimation.setDuration(500);
		return showAnimation;
	}
	
	/**
	 * 菜单进入屏幕的动画
	 * @return
	 */
	public static TranslateAnimation getInScreenTop(){
		TranslateAnimation showAnimation = new TranslateAnimation(
    			Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
    			Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF,0.0f);
		showAnimation.setFillAfter(true);
		showAnimation.setDuration(500);
		return showAnimation;
	}
	
	/**
	 * 以中心为原点翻转180度
	 * @return
	 */
	public static RotateAnimation getRote180(){
		RotateAnimation showAnimation = new RotateAnimation(0,180f, Animation.RELATIVE_TO_SELF,
				0.5f, Animation.RELATIVE_TO_SELF,0.5f);
		showAnimation.setFillAfter(true);
		showAnimation.setDuration(0);
		return showAnimation;
	}
	
	/**
	 * 以中心为原点翻转360度
	 * @return
	 */
	public static RotateAnimation getRote360(){
		RotateAnimation showAnimation = new RotateAnimation(0,360f, Animation.RELATIVE_TO_SELF,
				0.5f, Animation.RELATIVE_TO_SELF,0.5f);
		showAnimation.setFillAfter(true);
		showAnimation.setDuration(0);
		return showAnimation;
	}
	
}
